package ch.il07.converter.business.impl;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

import ch.il07.converter.business.UserBusiness;

public class UserBusinessImplTest {
	private UserBusiness ub = null;
	
	@Before
	public void setUp() throws Exception {
		// Directly call the implementation!
		ub = new UserBusinessImpl();
	}

	@Test
	public void testChangePassword() {
		assertTrue(ub.changePassword("test", "test", "test123"));
		assertTrue(ub.changePassword("test", "test123", "test"));
	}

	@Test
	public void testLogin() {
		assertTrue(ub.login("test", "test"));
		assertFalse(ub.login("test", "wr0ng_p4ssW0rD!!"));
		assertFalse(ub.login("wr0ng_uS3rn4m3!!", "wayne password"));
	}

	@Test
	public void testRegister() {
		assertTrue(ub.register("newuser", "newuserpassword", "newuser@santis.ch", 0));
		assertTrue(ub.deleteUser("newuser", "newuserpassword"));
		
	}
}